use ivrfaxdb
go

SELECT     CONVERT(char(6), dt_fpgopher_retrieve_tstamp, 112), vc_faxdocname, COUNT(int_faxdocid) AS Expr1
FROM         tbl_ivrfax_txns
GROUP BY CONVERT(char(6), dt_fpgopher_retrieve_tstamp, 112), vc_faxdocname
HAVING      (CONVERT(char(6), dt_fpgopher_retrieve_tstamp, 112) = '200911')
ORDER BY vc_faxdocname